package com.personal.gateway.config;

import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;

/**
 * @program: FlinkGateway
 * @description:
 * @author: yangliao
 * @create: 2021-09-14
 */
@Slf4j
@Data
@Configuration
public class ValueConfig {

    @Value("${spring.profiles.active}")
    private String active;

    @Value("${kubeConfigPath}")
    private String kubeConfigPath;

    public String getActiveProfile() {
        switch (active) {
            case "k8s-dev":
            case "k8s-staging":
            case "k8s-prod":
                String env = active.split("-")[active.split("-").length - 1];
                log.info("execution environment {}", env);
                return env;
            default:
                return "dev";
        }
    }

}
